package com.lyx.server.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * ⽤户优惠券表
 * @TableName t_user_coupon
 */
@TableName(value ="t_user_coupon")
@NoArgsConstructor
@Data
public class UserCoupon implements Serializable {
    /**
     * 序号，主键
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * ⽤户id
     */
    @TableField(value = "uid")
    private Integer uid;

    /**
     * 优惠券id
     */
    @TableField(value = "cid")
    private Integer cid;

    /**
     * 优惠券⾦额或折扣
     */
    @TableField(value = "money")
    private double money;

    /**
     * 使⽤的最低费⽤
     */
    @TableField(value = "usemoney")
    private double usemoney;

    /**
     * 状态：1.未使⽤ 2.已使⽤ 3.已退回
     */
    @TableField(value = "status")
    private String status;

    /**
     * 使⽤的开始⽇期
     */
    @TableField(value = "start_date")
    private Date startDate;

    /**
     * 使⽤结束⽇期
     */
    @TableField(value = "end_date")
    private Date endDate;

    /**
     * 优惠券类型
     */
    @TableField(value = "type")
    private String type;

    /**
     * 创建时间
     */
    @TableField(value = "create_time")
    private Date createTime;

    /**
     * 更新时间
     */
    @TableField(value = "update_time")
    private Date updateTime;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    public UserCoupon(Integer uid, Integer cid, double money, double usemoney, Date time, String type) {
        this.uid = uid;
        this.cid = cid;
        this.money = money;
        this.usemoney = usemoney;
        this.type = type;
        this.startDate=new Date();
        this.endDate=time;
        this.status="未使用";
        this.createTime=new Date();
        this.updateTime=new Date();
    }
}
